package com.woniuxy.orderassembly.controller;


import com.woniuxy.api.OrderComplainApi;
import com.woniuxy.common.Result;
import com.woniuxy.form.ModifyComplainForm;
import com.woniuxy.form.OrderComplainForm;
import com.woniuxy.orderassembly.service.IOrderComplainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chestnut
 * @since 2021-05-24
 */
@Slf4j
@RestController
public class OrderComplainController implements OrderComplainApi {
    @Resource
    private IOrderComplainService orderComplainService;
    //订单投诉
    @Override
    public Result createOrderComplain(OrderComplainForm orderComplainForm) {
        log.info("订单投诉表创建,{}",orderComplainForm);
        Result result = orderComplainService.addOrderComplain(orderComplainForm);
        return Result.success(result);
    }

    @Override
    public Result modifyOrderComplain(ModifyComplainForm modifyComplainForm) {
        log.info("修改订单投诉表,{}",modifyComplainForm);
        Result result = orderComplainService.modifyOrderComplain(modifyComplainForm);
        return Result.success(result);

    }

    @Override
    public Result delOrderComplain(Integer id) {
        log.info("订单投诉表删除,{}",id);
        Result result = orderComplainService.delOrderComplain(id);
        return result;
    }

    @Override
    public Result pageOrderComplain(Integer pageIdx) {
        log.info("分页展示订单投诉表,{}",pageIdx);
        Result result = orderComplainService.pageOrderComplain(pageIdx);
        return result;
    }

    @Override
    public Result pageOrderComplainByStatus(Integer pageIdx, Integer status) {
        log.info("状态分页展示订单投诉表,{}",pageIdx);
        Result result = orderComplainService.pageOrderComplainByStatus(status,pageIdx);
        return result;
    }
}

